'''
Created on Dec 6, 2010

@author: dexen
'''
import os

from dexen.system.common.meta import SchemaMeta
from dexen.system.common.base import BaseMasterTask

from dexen.system.common import utils

def test1():
    schema_dir = "/home/dexen/workspace/sample1"
    schema_zip = utils.get_schema_zip(schema_dir)
    print "zip len", len(schema_zip)

    schema_name = "Sample2Deneme"
    schema_meta = SchemaMeta(schema_zip, schema_name)
    schema_meta.setup_schema()
    print "Root dir", schema_meta.root_dir
    
    schema_meta.setup_env()
    master_task = schema_meta.get_master_task()
    assert isinstance(master_task, BaseMasterTask)
    master_task.__execute__(None)
    schema_meta.reset_env()
    schema_meta.teardown_schema()
    
def main():
    test1()


if __name__ == "__main__":
    main()